package com.server.llh.llhserverwork.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.llh.llhsuppliers.R;
import com.server.llh.llhserverwork.activity.infomation.InfoMationActivity;
import com.server.llh.llhserverwork.adapter.base.ViewHolderBase;
import com.server.llh.llhserverwork.bean.ZongheZxBena;
import com.server.llh.llhserverwork.port.HolderOnclickInterface;
import com.squareup.picasso.Picasso;


/**
 * Created by ZTF on 2017-05-04.
 * 咨询Holder
 */

public class ZiXunHolder extends ViewHolderBase<ZongheZxBena.DataBean> {

    private Context mContext;
    ImageView iv;
    TextView tvTitle,tvComment,tvDetail;

    public ZiXunHolder(InfoMationActivity context) {
        this.mContext = context;
    }
    @SuppressLint("InflateParams")
    @Override
    public View createView(LayoutInflater layoutInflater) {
        View v = LayoutInflater.from(mContext).inflate(R.layout.llh_infomation_lv_item, null);
        iv = (ImageView) v.findViewById(R.id.iv);
        tvTitle = (TextView) v.findViewById(R.id.tv_title);
        tvDetail = (TextView) v.findViewById(R.id.tv_detail);
        tvComment = (TextView) v.findViewById(R.id.tv_comment);
        return v;
    }

    @Override
    public void showData(final int position, ZongheZxBena.DataBean itemData) {
        if (itemData.getMessage_pic_a()!=null){
            Picasso.with(mContext)
                    .load(itemData.getMessage_pic_a())
                    .placeholder(R.drawable.icon_launcher)
                    .error(R.drawable.icon_launcher)
                    .into(iv);
        }
        tvTitle.setText(itemData.getMessage_title());
        tvDetail.setText(itemData.getMessage_abstract());
        tvComment.setText("");
    }

    @Override
    public void showData(int position, ZongheZxBena.DataBean itemData, HolderOnclickInterface holderOnclickInterface) {

    }


}
